/**
 * 工具条
 */
function ToolbarModule(ui, menuFlags, engine) {
	this.base = Module;
	this.base(ui, engine);
	this.menus = new Array();

	if (menuFlags.save) {
		var saveMenu = new Menu("save-menu", "保存", "fa-save");
		saveMenu.setClick(function() {
			engine.formModule.save();
		});
		this.addItem(saveMenu);
	}

	if (menuFlags.submit) {
		var submitMenu = new Menu("submit-menu", "提交", "fa-play");
		submitMenu.setClick(function() {
			engine.drive();
		});
		this.addItem(submitMenu);
	}

	if (menuFlags.flowLog) {
		var flowLogMenu = new Menu("flowLog-menu", "流程跟踪", "fa-play");
		flowLogMenu.setClick(function() {
			engine.flowLogModule.open();
		});
		this.addItem(flowLogMenu);
	}

	if (menuFlags.editDoc) {
		var editDocMenu = new Menu("flowLog-menu", "编辑正文", "fa-play");
		editDocMenu.setClick(function() {
			engine.editDocModule.open();
		});
		this.addItem(editDocMenu);
	}
}

ToolbarModule.prototype = new Module();
ToolbarModule.prototype.constructor = ToolbarModule;

ToolbarModule.prototype.addItem = function(item) {
	this.ui.append(item.getUI());
	this.menus.push(item);
};

ToolbarModule.prototype.disableItem = function(menuId) {
	for (var i = 0; i < this.menus.length; i++) {
		if (this.menus[i].id == menuId) {
			this.menus[i].ui.hide();
			break;
		}
	}
};